package chatroom;

import java.io.IOException;
import java.net.Socket;

/**
 * 聊天室的客户端
 *
 * @Author: xxf
 * @CreateDate: 2020/9/4 19:11
 * 1.连接服务端
 * 2.创建读写线程并传入socket对象
 * 3.启动线程
 */
public class ChatClient {
    @SuppressWarnings("all")
    public static void main(String[] args) {
        try {
            //创建客户端socket,第一个参数服务端ip,第二个参数服务端绑定的端口号
            Socket socket1 = new Socket("127.0.0.1", 9999);
            System.out.println("devvvvvvvvvvvvvvvvvvvvvvvvvvvvv");
            System.out.println("bug");
            System.out.println("mytest buyao  你离开 ");
            System.out.println("距离隔不开");
            //创建读写线程对象与服务器间进行通信
            WriteThread wt = new WriteThread(socket1);
            ReadThread rt = new ReadThread(socket1);
            System.out.println("我写了很多代码，但是要切换分支，那要怎么办");
            System.out.println("我写了很多代码，");
            System.out.println("我写了很多代码");
            System.out.println("我写了很多代码，现在要合并test分支");
//            sssss  bug
            //启动线程
            wt.start();
            rt.start();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}


class ChatClient2 {
    @SuppressWarnings("all")
    public static void main(String[] args) {
        try {
            //创建客户端socket,第一个参数服务端ip,第二个参数服务端绑定的端口号
            Socket socket1 = new Socket("127.0.0.1", 9999);

            //创建读写线程对象与服务器间进行通信
            WriteThread wt = new WriteThread(socket1);
            ReadThread rt = new ReadThread(socket1);

            //启动线程
            wt.start();
            rt.start();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}


class ChatClient3 {
    @SuppressWarnings("all")
    public static void main(String[] args) {
        try {
            //创建客户端socket,第一个参数服务端ip,第二个参数服务端绑定的端口号
            Socket socket1 = new Socket("127.0.0.1", 9999);

            //创建读写线程对象与服务器间进行通信
            WriteThread wt = new WriteThread(socket1);
            ReadThread rt = new ReadThread(socket1);

            //启动线程
            wt.start();
            rt.start();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}


class ChatClient4 {
    public static void main(String[] args) throws IOException {

        new Socket("10.3.143.", 9999);

    }
}
